/*
2GWVS a free web vulnerability scanner.
Copyright (C) 2008  Grigis Gaetan

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef _SCANNER_H_
#define _SCANNER_H_

#include <QHttp>
#include <QUrl>
#include <QWidget>
#include <QTreeWidget>
#include <QSettings>
#include <QtXml>
#include "urlCatched.h"
#include "issuesExecuter.h"
#include "runScanner.h"
#include "formCatched.h"
class Crawler : public QWidget
{
	Q_OBJECT
	public:
		Crawler(QUrl &url,QTreeWidget *tr);
		~Crawler();
		void CrawlWholeUrl();
		void addUrl(QString &url);
		int crawlerXml(QString &pageWeb);
                int crawlerHtml(QString &pageWeb,QString &url);
		QTreeWidgetItem* recursiveAdd(QTreeWidgetItem *item,QString &toFind,int prof); 
		//QStringList *getLinks();
	public slots:
		void getPage();
	private:
		static bool isCrawlerRunning;
		static int currentUrlCrawled;
		QHttp *http;
		QUrl startUrl;
		QString pageWeb;
		QTreeWidget *tr_result;
		QTreeWidgetItem *root;
		
		/*COOKIE AND ADDITIONNAL INFORMATION*/
		bool additionnalInfo;
		QTreeWidgetItem *cookie_tr;
		QStringList cookie_list;
                /*FORMS*/
                QTreeWidgetItem *form_tr;
};
#endif // !_SCANNER_H_
